package com.example.sb;


import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.PlatformTransactionManager;

import javax.annotation.PostConstruct;

@SpringBootApplication
@MapperScan(value = "com.example.sb.*",annotationClass = Repository.class)
//@EnableCaching
public class SbApplication {


    public static void main(String[] args) {
        SpringApplication.run(SbApplication.class, args);
    }

    @Autowired
    RedisTemplate<Object,Object> redisTemplate;

    @PostConstruct
    public void printTransactionManager(){
        RedisSerializer<String> stringSerializer = redisTemplate.getStringSerializer();
        redisTemplate.setKeySerializer(stringSerializer);
        redisTemplate.setHashKeySerializer(stringSerializer);
        redisTemplate.setHashValueSerializer(stringSerializer);
        System.out.println("<<<<<<<redistemplate init success>>>>>>>>");
    }


}
